from tkinter import * class Application(Frame): """A GUI application""" def __init__(self,master): """Initialize the frame""" Frame.__init__(self,master) self.grid() self.widg() def widg(self): """create buttons""" self.btn1=Button(self, text="Button 1") self.btn1.grid() self.btn2=Button(self, text="Button 2") self.btn2.grid() self.btn3=Button(self, text="Button 3") self.btn3.grid() root=Tk() root.title("Buttons") root.geometry("300x200") app=Application(root) root.mainloop()